# -*- coding: utf-8 -*-
# Copyright (C) 2012 Maira Carvalho <hello@mairacarvalho.com>
#
# This file is part of Kapybara's Imuri module, and is provided to you as is under the terms
# and conditions of the GPL v3 license. The license should have been provided to
# you with this package via the file gpl-3.0.txt, but if not you can see it
# online at https://www.gnu.org/licenses/gpl-3.0.html

from imuri.downloader import Imuri
import sys

'''Inform the language pair in the following format
    languages = {
        "source":{'code':'en','name':'English'},
        "target":{'code':'hr','name':'Serbo-Croatian'}
    }

'''


languages = {
    "source":{'code':'en','name':'English'},
    "target":{'code':'pt','name':'Portuguese'}
}

lookup_word = "mato"

print "Initializing Imuri..."
print

myImuri = Imuri(languages)

print "Looking up word \"%s\" in %s, searching in %s Wiktionary." % (lookup_word, languages['target']['name'],languages['source']['name'])
print

query_results = myImuri.get_raw_content(lookup_word)

if (query_results['exit_status'] == 0): 
    
    
    print query_results['message']
    print
    retrieved_content = query_results['content']
    cleaned_content = myImuri.clean_raw_content(retrieved_content)
    
    
    print '======================================'
    print cleaned_content
    print '======================================'
    
    
else:
    print query_results['message']
print
print 'The end.'
print '----------------------------------------------------'
print '----------------------------------------------------'
print 

